home *** CD-ROM | disk | FTP | other *** search
/ Workplace Effectiveness:…ecision-Making Strategies / Workplace Effectiveness: Decision-Making Strategies.iso / pc / Files / Main.dxr / 00010_Pushbutton w-handler attached.ls < prev    next >
Encoding:
Text File  |  1998-12-16  |  2.0 KB  |  54 lines

  1. property upMember, downMember, button_active, myAction, scriptLoc
  2.  
  3. on mouseDown me
  4.   set the member of sprite the spriteNum of me to member the downMember of me
  5.   set the button_active of me to 1
  6. end
  7.  
  8. on mouseUp me
  9.   set the member of sprite the spriteNum of me to member the upMember of me
  10.   set the button_active of me to 0
  11.   updateStage()
  12.   call(myAction, script scriptLoc)
  13. end
  14.  
  15. on mouseEnter me
  16.   if the button_active of me then
  17.     set the member of sprite the spriteNum of me to member the downMember of me
  18.   end if
  19. end
  20.  
  21. on mouseLeave me
  22.   if the button_active of me then
  23.     set the member of sprite the spriteNum of me to member the upMember of me
  24.   end if
  25. end
  26.  
  27. on mouseUpOutSide me
  28.   set the button_active of me to 0
  29. end
  30.  
  31. on beginSprite me
  32.   set the upMember of me to the member of sprite the spriteNum of me
  33.   set the button_active of me to 0
  34. end
  35.  
  36. on endSprite me
  37. end
  38.  
  39. on getPropertyDescriptionList
  40.   if the currentSpriteNum = 0 then
  41.     set memdefault to 0
  42.   else
  43.     set memref to the member of sprite the currentSpriteNum
  44.     set castLibNum to the castLibNum of memref
  45.     set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  46.   end if
  47.   set p_list to [#downMember: [#comment: "Down state member:", #format: #graphic, #default: memdefault], #myAction: [#comment: "Type a handler for this button:", #format: #symbol, #default: #empty], #scriptLoc: [#comment: "Which is in movie script:", #format: #script, #default: EMPTY]]
  48.   return p_list
  49. end
  50.  
  51. on getBehaviorDescription
  52.   return "Makes a sprite work as a pushbutton with down state and mouse tracking. The sprite's initial castmember represents the button's normal state." & RETURN & "PARAMETERS:" & RETURN & "‚Ä¢ Down member - Choose the cast member to display when the button is pressed. The default value is the cast member immedietly following the sprite's current cast member." & RETURN & "‚Ä¢ Action - the handler to activate" & RETURN & "‚Ä¢ Movie script - location of the handler. This way the code gets compiled, avoiding the 'do' command."
  53. end
  54.